#define BLINKER_PRINT Serial
#define BLINKER_WIFI

#include <Arduino.h>
#include "Blinker.h"


char auth[] = "f9939a4d97b8";
char ssid[] = "dayuan";
char pswd[] = "19900625";

BlinkerButton Button1("btn");

//f9939a4d97b8
void button1_callback(const String & state) {
  if(state =="on"){ //开关被打开
    digitalWrite(LED_BUILTIN,LOW);
    Button1.text("已打开");
    Button1.print("on");
  }else{  //开关被关闭
    digitalWrite(LED_BUILTIN,HIGH);
    Button1.text("已关闭");
    Button1.print("off");
  }
}

void setup() {
  Serial.begin(115200);

  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);

  Blinker.begin(auth, ssid, pswd);
  Button1.attach(button1_callback);
   
}

void loop() {
  Blinker.run();
}